<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        {{ user.fullName }}
    </div>

    <script src="../../dist/vue.js"></script>
    <script>
        const vm = new Vue({
            el: '#app',
            data: {
                user: {
                    firstName: '诸葛',
                    lastName: '亮',
                    fullName: ''
                }
            }
        })

        vm.$watch('user', 
            function (newValue, oldValue) {
            this.user.fullName = newValue.firstName + ' ' + newValue.lastName
        }, {
            immediate: true,
            deep: true
        })
    </script>
</body>
</html>